2186, 2058, 1760, 1760, 1978, 1760)
emg_HEX_model <- 'Emg ~ H + ES + X + A + C + O'
emg_HEX_fit <- sem(emg_HEX_model, sample.cov = cor_HEX_emg,
sample.nobs = harmonic.mean(N_HEX_emg))  # 6536.906
summary(emg_HEX_fit, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)[[6]]
sqrt(0.02263158)
# Leadership Effectiveness (Overall) - Main Effect --------------------------------------
data_HEXACO_eff <- data_HEXACO %>% filter(OVERALL_INCLUSION == 1)
HEXACO_eff_results <- HEX_analysis(data_HEXACO_eff, IV_name = "IV",
var_names = list(rxx = "rxx", ryy = "ryy", rxy = "rxy", N = "N"))
format_file(HEXACO_eff_results$overall)
# Leadership Effectiveness - Multiple R ---------------------------------------
## Moshagen et al., (2019) intercorrelations + EFF-HEXACO correlations ------------------
cor_HEX_eff <- lav_matrix_lower2full(
c(1,
0.21,	1,
0.42,	0.08,	1,
-0.15,	0.03,	0.10,	1,
0.15,	0.13,	0.13,	0.06,	1,
-0.01,	0.23,	0.20,	0.19,	0.17,	1,
0.24,	0.31,	0.21, 0.04, 0.17,	0.32,	1))
colnames(cor_HEX_eff) <- c("H", "C", "A", "ES", "O", "X", "Eff")
## Moshagen et al., (2019) intercorrelations + EFF-HEXACO N ------------------
N_HEX_eff <- c(253825, 252954, 257009, 255134, 255889,
253380, 254302, 253193, 253575,
252893, 252711, 253719,
254428, 253976,
252963,
3094, 1867, 2023, 2146, 1867, 1867)
eff_HEX_model <- 'Eff ~ H + ES + X + A + C + O'
eff_HEX_fit <- sem(eff_HEX_model, sample.cov = cor_HEX_eff,
sample.nobs = harmonic.mean(N_HEX_eff))  # 7120.049
summary(eff_HEX_fit, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)[[6]]
sqrt(0.207617398)
# Leadership Effectiveness (Narrow) - Main Effect --------------------------------------
data_HEXACO_eff_J <- data_HEXACO %>% filter(DV_JUDGE_EFF == 1)
HEXACO_eff_J_results <- HEX_analysis(data_HEXACO_eff_J, IV_name = "IV",
var_names = list(rxx = "rxx", ryy = "ryy", rxy = "rxy", N = "N"))
format_file(HEXACO_eff_J_results$overall)
format_file(HEXACO_eff_results$overall)
cor_HEX_eff_J <- lav_matrix_lower2full(
c(1,
0.21,	1,
0.42,	0.08,	1,
-0.15,	0.03,	0.10,	1,
0.15,	0.13,	0.13,	0.06,	1,
-0.01,	0.23,	0.20,	0.19,	0.17,	1,
0.25,	0.38,	0.09, 0.16, 0.14,	0.16,	1))
colnames(cor_HEX_eff_J) <- c("H", "C", "A", "ES", "O", "X", "Eff")
N_HEX_eff_J <- c(253825, 252954, 257009, 255134, 255889,
253380, 254302, 253193, 253575,
252893, 252711, 253719,
254428, 253976,
252963,
1045, 807, 807, 930, 807, 807)
harmonic.mean(N_HEX_eff_J)
cor_HEX_eff_J
summary(eff_HEX_fit, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)[[6]]
summary(eff_HEX_fit_J, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)[[6]]
# eff_HEX_model <- 'Eff ~ H + ES + X + A + C + O'
eff_HEX_fit_J <- sem(eff_HEX_model, sample.cov = cor_HEX_eff_J,
sample.nobs = harmonic.mean(N_HEX_eff_J))  # 2979.614
summary(eff_HEX_fit_J, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)[[6]]
sqrt(0.215702836)
setwd("D:/Anoop Meta-Analysis/Supplementary Materials - 032023/Analysis/3. Moderating Effect of Collectivism")
source("../Utilities/Utilities-Main.R")
source("../Utilities/Utilities-Extra.R")
library(lm.beta)
# Moderating Effect for Extraversion and Agreeableness --------------------------------------
data_FFM <- readxl::read_excel("../../DataSet/B5L_Analysis_MASTER_NEW1124_NEW.xlsx", sheet = "Coding")
data_FFM_eff <- data_FFM %>% filter(`OVERALL EFFECTIVENESS INCLUSION?` == 1 & `Article ID`!="FFM_903")
eff_E <- data_FFM_eff %>% filter(IV == 3)
eff_A <- data_FFM_eff %>% filter(IV == 4)
calculation_mod(eff_E, mods = eff_E$Collectivism, method = "HS")$result  # p = .0128
calculation_mod(eff_E, mods = eff_E$Collectivism)$detail_CI
lm.beta(calculation_mod(eff_E, mods = eff_E$Collectivism)$linear_estimate)
calculation_mod(eff_A, mods = eff_A$Collectivism, method = "HS")$result  # p = .0129
calculation_mod(eff_A, mods = eff_A$Collectivism)$detail_CI
lm.beta(calculation_mod(eff_A, mods = eff_A$Collectivism)$linear_estimate)
### Single, continuous moderator analysis.
### Simple effects are estimated using a fixed effect linear model.
### If you need multiple moderators, you can use get_data(), add other moderators and imitate the syntax in calculation_mod().
calculation_mod <- function(input, mods, valueX, valueY, xlab = "", ylab = "", main = "", method = "HS",
var_names = list(rxx = "rxx",
ryy = "ryy",
rxy = "rxy",
N = "N")) {
digits <- 2
if (is.null(input)) return(NULL)
if (nrow(input) < 2) return(NULL)
ri <- as.numeric(unlist(input[var_names$rxy]))
ni <- as.numeric(unlist(input[var_names$N]))
rxx <- as.numeric(unlist(input[var_names$rxx]))
ryy <- as.numeric(unlist(input[var_names$ryy]))
data <- cbind(ri, ni, rxx, ryy)
## Mean Imputation
rxx = rxx %>% tidyr::replace_na(mean(na.omit(rxx)))
ryy = ryy %>% tidyr::replace_na(mean(na.omit(ryy)))
## If mean(na.omit()) fails, result will become all NaN. In this case we replace NaN with 1 (Alpha = 1)
if (is.na(rxx[1])) {
# print("Artificial Alpha X was imputed")
if (missing(valueX)) valueX <- 1
# print(valueX)
rxx <- valueX
}
if (is.na(ryy[1])) {
# print("Artificial Alpha Y was imputed")
if (missing(valueY)) valueY <- 1
# print(valueY)
ryy <- valueY
}
k = length(ri)
N = sum(ni)
ri <- ifelse(ri==0,0.0000001, ri)
### Schmidt & Hunter (2014)
# Mean uncorrected correlation (p. 144)
# "This is the sample size weight average of the observed correlations."
M1 <- sum(ni*ri)/sum(ni)  # weighted mean, uncorrected (bare bones)
print(sprintf("Bare bones correlation:%.3f", M1))
# Formula 3.2: Corresponding sampling variance across studies
var_M1 <- sum(ni*(ri-M1)^2)/sum(ni)
# This calculates the sampling error variance in the UNCORRECTED correlation, where
# M1 is the mean uncorrected correlation across studies, and
# ni is the sample size for each study. (p. 144)
var.i <-((1-M1^2)^2)/(ni-1) # individual study sampling variance (bare bones)
# Formula 3.25: Compound attenuation factor.
ai <- sqrt(rxx*ryy) # individual study attenuation for unreliability
# Formula 3.27: Sampling error variance in the CORRECTED correlation
var.i2 <- var.i/(ai^2) # corrected individual study sampling variance for unreliability
# Formula 3.26: From observed correlation to corrected correlation
ri.m <- ri/ai # corrected individual study ES for unreliability
### p. 145-146: What weights should be used?
# (p. 147) When studies differ greatly on one or more of the artifacts corrected,
# then more complicated weighting makes better use of the information in the studies.
#
weights = 1/var.i2
# res_mods = rma(ri.m, var.i2, weights = ni-3, mods = mods, method = method, test = "knha")
#
# res_mods = rma(ri.m, var.i2, weights = 1/var.i2, mods = mods, method = "HS", test = "knha")
z.m <- escalc(ri = ri.m, measure = "ZCOR", ni = ni)
res_mods = rma(z.m, var.i2, weights = ni-3, mods = mods, method = method, test = "knha")
k = length(na.omit(mods))
c = length(unique(na.omit(mods)))
df <- data.frame(ri.m, mods, ni, weights)
df <- df %>% filter(!is.na(mods))
# linear_model <- lm(ri.m ~ mods, weights = ni, data = df)
linear_model <- lm(ri.m ~ mods, weights = weights, data = df)
Low <- mean(mods, na.rm = TRUE) - sd(mods, na.rm = TRUE)
High <- mean(mods, na.rm = TRUE) + sd(mods, na.rm = TRUE)
pred_low <- predict(linear_model, data.frame(mods = Low),
interval = "confidence", level = .95, se.fit = TRUE)
pred_high <- predict(linear_model, data.frame(mods = High),
interval = "confidence", level = .95, se.fit = TRUE)
detail_CI <- c(low_estimate = roundif(pred_low$fit[1],2),
high_estimate = roundif(pred_high$fit[1],2),
low_CV = paste("[",roundif(pred_low$fit[2],2),",",roundif(pred_low$fit[3],2),"]",sep = ""),
high_CV = paste("[",roundif(pred_high$fit[2],2),",",roundif(pred_high$fit[3],2),"]",sep = ""))
## plot = plot(mods, ri.m, pch = 20, xlab = xlab, ylab = ylab, main = main, family = "serif") + abline(res_mods) + grid() temporarily removed
return(list(result = res_mods, result_fixed = summary(linear_model), num_studies = k, num_countries = c,
details = data.frame(ci.lower = res_mods$ci.lb, ci.upper = res_mods$ci.ub),
linear_estimate = linear_model, R2 = res_mods$R2 / 100, beta = sqrt(res_mods$R2 / 100),
predict_high = pred_high, predict_low = pred_low, detail_CI = detail_CI))
}
calculation_mod(eff_E, mods = eff_E$Collectivism, method = "HS")$result  # p = .0128
calculation_mod(eff_A, mods = eff_A$Collectivism, method = "HS")$result  # p = .0129
### Single, continuous moderator analysis.
### Simple effects are estimated using a fixed effect linear model.
### If you need multiple moderators, you can use get_data(), add other moderators and imitate the syntax in calculation_mod().
calculation_mod <- function(input, mods, valueX, valueY, xlab = "", ylab = "", main = "", method = "HS",
var_names = list(rxx = "rxx",
ryy = "ryy",
rxy = "rxy",
N = "N")) {
digits <- 2
if (is.null(input)) return(NULL)
if (nrow(input) < 2) return(NULL)
ri <- as.numeric(unlist(input[var_names$rxy]))
ni <- as.numeric(unlist(input[var_names$N]))
rxx <- as.numeric(unlist(input[var_names$rxx]))
ryy <- as.numeric(unlist(input[var_names$ryy]))
data <- cbind(ri, ni, rxx, ryy)
## Mean Imputation
rxx = rxx %>% tidyr::replace_na(mean(na.omit(rxx)))
ryy = ryy %>% tidyr::replace_na(mean(na.omit(ryy)))
## If mean(na.omit()) fails, result will become all NaN. In this case we replace NaN with 1 (Alpha = 1)
if (is.na(rxx[1])) {
# print("Artificial Alpha X was imputed")
if (missing(valueX)) valueX <- 1
# print(valueX)
rxx <- valueX
}
if (is.na(ryy[1])) {
# print("Artificial Alpha Y was imputed")
if (missing(valueY)) valueY <- 1
# print(valueY)
ryy <- valueY
}
k = length(ri)
N = sum(ni)
ri <- ifelse(ri==0,0.0000001, ri)
### Schmidt & Hunter (2014)
# Mean uncorrected correlation (p. 144)
# "This is the sample size weight average of the observed correlations."
M1 <- sum(ni*ri)/sum(ni)  # weighted mean, uncorrected (bare bones)
print(sprintf("Bare bones correlation:%.3f", M1))
# Formula 3.2: Corresponding sampling variance across studies
var_M1 <- sum(ni*(ri-M1)^2)/sum(ni)
# This calculates the sampling error variance in the UNCORRECTED correlation, where
# M1 is the mean uncorrected correlation across studies, and
# ni is the sample size for each study. (p. 144)
var.i <-((1-M1^2)^2)/(ni-1) # individual study sampling variance (bare bones)
# Formula 3.25: Compound attenuation factor.
ai <- sqrt(rxx*ryy) # individual study attenuation for unreliability
# Formula 3.27: Sampling error variance in the CORRECTED correlation
var.i2 <- var.i/(ai^2) # corrected individual study sampling variance for unreliability
# Formula 3.26: From observed correlation to corrected correlation
ri.m <- ri/ai # corrected individual study ES for unreliability
### p. 145-146: What weights should be used?
# (p. 147) When studies differ greatly on one or more of the artifacts corrected,
# then more complicated weighting makes better use of the information in the studies.
#
weights = 1/var.i2
# res_mods = rma(ri.m, var.i2, weights = ni-3, mods = mods, method = method, test = "knha")
#
# res_mods = rma(ri.m, var.i2, weights = 1/var.i2, mods = mods, method = "HS", test = "knha")
z.m <- escalc(ri = ri, measure = "ZCOR", ni = ni)
res_mods = rma(z.m, var.i2, weights = ni-3, mods = mods, method = method, test = "knha")
k = length(na.omit(mods))
c = length(unique(na.omit(mods)))
df <- data.frame(ri.m, mods, ni, weights)
df <- df %>% filter(!is.na(mods))
# linear_model <- lm(ri.m ~ mods, weights = ni, data = df)
linear_model <- lm(ri.m ~ mods, weights = weights, data = df)
Low <- mean(mods, na.rm = TRUE) - sd(mods, na.rm = TRUE)
High <- mean(mods, na.rm = TRUE) + sd(mods, na.rm = TRUE)
pred_low <- predict(linear_model, data.frame(mods = Low),
interval = "confidence", level = .95, se.fit = TRUE)
pred_high <- predict(linear_model, data.frame(mods = High),
interval = "confidence", level = .95, se.fit = TRUE)
detail_CI <- c(low_estimate = roundif(pred_low$fit[1],2),
high_estimate = roundif(pred_high$fit[1],2),
low_CV = paste("[",roundif(pred_low$fit[2],2),",",roundif(pred_low$fit[3],2),"]",sep = ""),
high_CV = paste("[",roundif(pred_high$fit[2],2),",",roundif(pred_high$fit[3],2),"]",sep = ""))
## plot = plot(mods, ri.m, pch = 20, xlab = xlab, ylab = ylab, main = main, family = "serif") + abline(res_mods) + grid() temporarily removed
return(list(result = res_mods, result_fixed = summary(linear_model), num_studies = k, num_countries = c,
details = data.frame(ci.lower = res_mods$ci.lb, ci.upper = res_mods$ci.ub),
linear_estimate = linear_model, R2 = res_mods$R2 / 100, beta = sqrt(res_mods$R2 / 100),
predict_high = pred_high, predict_low = pred_low, detail_CI = detail_CI))
}
calculation_mod(eff_E, mods = eff_E$Collectivism, method = "HS")$result  # p = .0128 / 0.0188 for Z
calculation_mod(eff_A, mods = eff_A$Collectivism, method = "HS")$result  # p = .0129 / 0.0598
calculation_mod(eff_E_J, mods = eff_E_J$Collectivism, method = "HS")$result  # p = .0312, k = 71
calculation_mod(eff_A_J, mods = eff_A_J$Collectivism, method = "HS")$result  # p = ns, k = 59
calculation_mod(eff_A, mods = eff_A$Collectivism, method = "HS")$result  # p = .0129 / 0.0377 for Z
calculation_mod(eff_E, mods = eff_E$Collectivism, method = "HS")$result  # p = .0128 / 0.0132 for Z
calculation_mod(eff_A, mods = eff_A$Collectivism, method = "HS")$result  # p = .0129 / 0.0377 for Z
calculation_mod(eff_E, mods = eff_E$Collectivism, method = "HE")$result  # p = .0128 / 0.0132 for Z
calculation_mod(eff_A, mods = eff_A$Collectivism, method = "HE")$result  # p = .0129 / 0.0377 for Z
setwd("D:/Anoop Meta-Analysis/ROUND 3 MANUSCRIPT/B5L R&R2 (May 2023)-20230820T064706Z-001/B5L R_R2 (May 2023)/SUPPLEMENTARY MATERIAL/Analysis/3. Moderating Effect of Collectivism")
source("../Utilities/Utilities-Main.R")
source("../Utilities/Utilities-Extra.R")
library(lm.beta)
# Moderating Effect for Extraversion and Agreeableness --------------------------------------
data_FFM <- readxl::read_excel("../../DataSet/B5L_Analysis_MASTER_NEW1124_NEW.xlsx", sheet = "Coding")
data_FFM_emg <- data_FFM %>% filter(DV == 1 & `INCLUDE IN ANALYSIS?` == 1)
emg_E <- data_FFM_emg %>% filter(IV == 3)
emg_A <- data_FFM_emg %>% filter(IV == 4)
emg_C <- data_FFM_emg %>% filter(IV == 2)
emg_N <- data_FFM_emg %>% filter(IV == 5)
emg_O <- data_FFM_emg %>% filter(IV == 1)
calculation_mod(emg_E, mods = emg_E$Collectivism)$result  # ns
calculation_mod(emg_E, mods = emg_E$Collectivism)$result  # ns
calculation_mod(emg_E, mods = emg_E$Collectivism)$detail_CI  # ns
calculation_mod(emg_A, mods = emg_A$Collectivism)$detail_CI
calculation_mod(emg_C, mods = emg_C$Collectivism)$result  # ns
calculation_mod(emg_C, mods = emg_C$Collectivism)$detail_CI
calculation_mod(emg_N, mods = emg_N$Collectivism)$result  # ns
calculation_mod(emg_N, mods = emg_N$Collectivism)$detail_CI
calculation_mod(emg_O, mods = emg_O$Collectivism)$result  # ns
calculation_mod(emg_O, mods = emg_O$Collectivism)$detail_CI
calculation_mod
calculation_mod(emg_O, mods = emg_O$Collectivism)$result  # ns
calculation_mod(emg_O, mods = emg_O$Collectivism)$detail_CI
data_HEXACO <- readxl::read_excel("../../DataSet/B5L_Analysis_HEXACO_NEW_1119.xlsx", sheet = "HEXACO Coding")
data_HEXACO_emg <- data_HEXACO %>% filter(DV == 1 & INCLUDE_TYPE == 1)
emg_H <- data_HEXACO_emg %>% filter(IV == 6)
calculation_mod(emg_H, mods = emg_H$Collectivism)$result    # ns
calculation_mod(emg_H, mods = emg_H$Collectivism)$detail_CI
emg_H <- data_HEXACO_emg %>% filter(IV == 6)
emg_EE <- data_HEXACO_emg %>% filter(IV == 5)
emg_XX <- data_HEXACO_emg %>% filter(IV == 3)
emg_AA <- data_HEXACO_emg %>% filter(IV == 4)
emg_CC <- data_HEXACO_emg %>% filter(IV == 2)
emg_OO <- data_HEXACO_emg %>% filter(IV == 1)
calculation_mod(emg_H, mods = emg_H$Collectivism)$result    # ns
calculation_mod(emg_H, mods = emg_H$Collectivism)$detail_CI
calculation_mod(emg_EE, mods = emg_EE$Collectivism)$detail_CI
calculation_mod(emg_EE, mods = emg_EE$Collectivism)$result
calculation_mod(emg_EE, mods = emg_EE$Collectivism)$detail_CI
calculation_mod(emg_XX, mods = emg_XX$Collectivism)$detail_CI
calculation_mod(emg_AA, mods = emg_AA$Collectivism)$detail_CI
calculation_mod(emg_CC, mods = emg_CC$Collectivism)$detail_CI
calculation_mod(emg_OO, mods = emg_OO$Collectivism)$detail_CI
source("../Utilities/Utilities-Main.R")
source("../Utilities/Utilities-Extra.R")
library(lm.beta)
# Moderating Effect for Extraversion and Agreeableness --------------------------------------
data_FFM <- readxl::read_excel("../../DataSet/B5L_Analysis_MASTER_NEW1124_NEW.xlsx", sheet = "Coding")
data_FFM_eff <- data_FFM %>% filter(`OVERALL EFFECTIVENESS INCLUSION?` == 1 & `Article ID`!="FFM_903")
eff_E <- data_FFM_eff %>% filter(IV == 3)
eff_A <- data_FFM_eff %>% filter(IV == 4)
calculation_mod(eff_E, mods = eff_E$Collectivism, method = "HS")$result  # p = .0128 / 0.0132 for Z
calculation_mod(eff_E, mods = eff_E$Collectivism)$detail_CI
calculation_mod(eff_A, mods = eff_A$Collectivism, method = "HS")$result  # p = .0129 / 0.0377 for Z
calculation_mod(eff_A, mods = eff_A$Collectivism)$detail_CI
data_FFM_J <- readxl::read_excel("../../DataSet/B5L_Analysis_MASTER_NEW1124_NEW.xlsx", sheet = "Coding-Judge_Op")
data_FFM_J_eff <- data_FFM_J %>% filter(INCLUDE_AS_JUDGE_OP == 1)
eff_E_J <- data_FFM_J_eff %>% filter(IV == 3)
eff_A_J <- data_FFM_J_eff %>% filter(IV == 4)
calculation_mod(eff_E_J, mods = eff_E_J$Collectivism, method = "HS")$result  # p = .0312, k = 71, p =.0399 for Z
calculation_mod(eff_E_J, mods = eff_E_J$Collectivism)$detail_CI
calculation_mod(eff_A_J, mods = eff_A_J$Collectivism, method = "HS")$result  # p = ns, k = 59, p = .2615 for Z
calculation_mod(eff_A_J, mods = eff_A_J$Collectivism)$detail_CI
calculation_mod(eff_C_J, mods = eff_C_J$Collectivism)$detail_CI
eff_C_J <- data_FFM_J_eff %>% filter(IV == 2)
eff_N_J <- data_FFM_J_eff %>% filter(IV == 5)
eff_O_J <- data_FFM_J_eff %>% filter(IV == 1)
calculation_mod(eff_C_J, mods = eff_C_J$Collectivism)$detail_CI
calculation_mod(eff_N_J, mods = eff_N_J$Collectivism)$detail_CI
calculation_mod(eff_N_J, mods = eff_N_J$Collectivism)$result
calculation_mod(eff_N_J, mods = eff_N_J$Collectivism)$detail_CI
calculation_mod(eff_A_J, mods = eff_A_J$Collectivism, method = "HS")$result  # p = ns, k = 59, p = .2615 for Z
calculation_mod(eff_E_J, mods = eff_E_J$Collectivism, method = "HS")$result  # p = .0312, k = 71, p =.0399 for Z
calculation_mod(eff_N_J, mods = eff_N_J$Collectivism)$detail_CI
calculation_mod(eff_O_J, mods = eff_O_J$Collectivism)$detail_CI
data_HEXACO_eff_J <- data_HEXACO %>% filter(DV_JUDGE_EFF == 1)
eff_J_HH <- data_HEXACO_eff_J %>% filter(IV == 6)
eff_J_HH <- data_HEXACO_eff_J %>% filter(IV == 6)
eff_J_EE <- data_HEXACO_eff_J %>% filter(IV == 5)
eff_J_XX <- data_HEXACO_eff_J %>% filter(IV == 3)
eff_J_AA <- data_HEXACO_eff_J %>% filter(IV == 4)
eff_J_CC <- data_HEXACO_eff_J %>% filter(IV == 2)
eff_J_OO <- data_HEXACO_eff_J %>% filter(IV == 1)
calculation_mod(eff_J_HH, mods = eff_J_HHJ$Collectivism)$detail_CI
calculation_mod(eff_J_HH, mods = eff_J_HH$Collectivism)$detail_CI
calculation_mod(eff_J_HH, mods = eff_J_HH$Collectivism)$result
calculation_mod(eff_J_HH, mods = eff_J_HH$Collectivism)$detail_CI
calculation_mod(eff_J_EE, mods = eff_J_EE$Collectivism)$detail_CI
calculation_mod(eff_J_XX, mods = eff_J_XX$Collectivism)$detail_CI
calculation_mod(eff_J_AA, mods = eff_J_AA$Collectivism)$detail_CI
calculation_mod(eff_J_AA, mods = eff_J_AA$Collectivism)
eff_J_AA$Collectivism
eff_J_AA$rxy
calculation_mod(eff_J_AA, mods = eff_J_AA$Collectivism)$detail_CI
calculation_mod(eff_J_CC, mods = eff_J_CC$Collectivism)$detail_CI
calculation_mod(eff_J_OO, mods = eff_J_OO$Collectivism)$detail_CI
data_FFM_unit <- data_FFM %>% filter(`INCLUDE IN ANALYSIS?` == 1 & DV == 3)
data_FFM_unit <- data_FFM %>% filter(`INCLUDE IN ANALYSIS?` == 1 & DV == 3)
eff_E_unit <- data_FFM_unit %>% filter(IV == 3)
eff_A_unit <- data_FFM_unit %>% filter(IV == 4)
eff_C_unit <- data_FFM_unit %>% filter(IV == 2)
eff_N_unit <- data_FFM_unit %>% filter(IV == 5)
eff_O_unit <- data_FFM_unit %>% filter(IV == 1)
calculation_mod(eff_E_unit, mods = eff_E_unit$Collectivism)$detail_CI
calculation_mod(eff_A_unit, mods = eff_A_unit$Collectivism)$detail_CI
mods = eff_E_unit$Collectivism
mods
calculation_mod(eff_C_unit, mods = eff_C_unit$Collectivism)$detail_CI
calculation_mod(eff_N_unit, mods = eff_N_unit$Collectivism)$detail_CI
calculation_mod(eff_O_unit, mods = eff_O_unit$Collectivism)$detail_CI
calculation_mod(eff_O_unit, mods = eff_O_unit$Collectivism)$result
mods = eff_C_unit$Collectivism
eff_C_unit[,c("rxy", "Collecitivism")]
eff_C_unit[,c("rxy", "Collectivism")]
eff_C_unit[,c("rxy", "Collectivism", "N")]
calculation_mod(eff_C_unit, mods = eff_C_unit$Collectivism)$result
eff_A_unit[,c("rxy", "Collectivism", "N")]
eff_E_unit[,c("rxy", "Collectivism", "N")]
setwd("D:/Anoop Meta-Analysis/ROUND 3 MANUSCRIPT/B5L R&R2 (May 2023)-20230820T064706Z-001/B5L R_R2 (May 2023)/SUPPLEMENTARY MATERIAL/Analysis/5. Predicting Leadership Effectiveness")
0.154*0.154
cor_FFM_UP <- lav_matrix_lower2full(
c(1,
0.27,	1,
0.25,	0.2,	1,
0.14,	0.16,	0.09,	1,
0.19,	0.21,	0.21,	0.27,	1,
0.15, 0.10, 0.17, 0.23, 0.12, 1))
colnames(cor_FFM_UP) <- c("C", "A", "ES", "O", "E", "UP")
## Steel et al., (2019) corresponding N for intercorrelations, and Narrow-FFM N ------------------
N_FFM_UP <- c(210288,
207955, 168670,
210270, 178234, 157731,
175189, 158974, 192156, 180405,
3220, 2917, 1800, 1828, 2043)
UP_model <- 'UP ~ E + A + C + ES + O'
UP_fit <- sem(UP_model, sample.cov = cor_FFM_UP,
sample.nobs = harmonic.mean(N_FFM_UP))
summary(UP_fit, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE)[[6]]
sqrt(0.08338168)
source("../Utilities/Utilities-Main.R")
source("../Utilities/Utilities-Extra.R")
############# This file produces results analyzing the moderating effect of categorical moderators #############
###### Main effect for FFM #############################
data_FFM <- readxl::read_excel("../../DataSet/B5L_Analysis_MASTER_NEW1124_NEW.xlsx", sheet = "Coding")
data_FFM_emg <- data_FFM %>% filter(DV == 1 & `INCLUDE IN ANALYSIS?` == 1)
FFM_order <- c("E","A","C","N","O")
# Type of organization.
# 1 - Social Service, 2 - Education, 3 - Business, 5 - Military, 6 - Mixed
emg_mod_org <- BF_analysis(data_FFM_emg, mod = "mod_organization", IV_name = "IV")$mod_result
type_of_organization <- format_file_mods(emg_mod_org, order = FFM_order, write = TRUE, filename = "emg_org.csv")
# Hierarchical level.
# 1 - Lower level supervisors, 2 - Middle managers, 3 - Upper level managers, 4 - Mixed or unclear
emg_mod_hier <- BF_analysis(data_FFM_emg, mod = "mod_hierarchicallevel", IV_name = "IV")$mod_result
hierarchical_level <- format_file_mods(emg_mod_hier, order = FFM_order, write = TRUE, filename = "emg_hier.csv")
# Study setting.
# 1 - Laboratory, 2 - Organization, 3 - Classroom
emg_mod_setting <- BF_analysis(data_FFM_emg, mod = "mod_setting", IV_name = "IV")$mod_result
study_setting <- format_file_mods(emg_mod_setting, order = FFM_order, write = TRUE, filename = "emg_setting.csv")
# Social complexity.
# 1 - Low complexity, 2 - High complexity
emg_mod_complexity <- BF_analysis(data_FFM_emg, mod = "mod_socialcomplexityoftask", IV_name = "IV")$mod_result
social_complexity <- format_file_mods(emg_mod_complexity, order = FFM_order, write = TRUE, filename = "emg_social.csv")
# Basis for appointing leader.
# 1 - Random, 2 - Qualification, 3 - Emerged/Leaderless group, 4 - Mixed or unclear
emg_mod_appointleader <- BF_analysis(data_FFM_emg, mod = "mod_basisforlaboratoryleadership", IV_name = "IV")$mod_result
basis_appointment <- format_file_mods(emg_mod_appointleader, order = FFM_order, write = TRUE, filename = "emg_basis.csv")
# Length of interaction.
# 1 - < 20 mins, 2 - > 20 mins, one interaction, 3 - More than one interaction, 4 - Mixed or not applicable
# Category 4 not presented because many emergence studies happened to be not involving interaction contexts.
emg_mod_length_interaction <- BF_analysis(data_FFM_emg, mod = "mod_lengthofinteraction", IV_name = "IV")$mod_result
length_interaction <- format_file_mods(emg_mod_length_interaction, order = FFM_order, write = TRUE, filename = "emg_length.csv")
# Measure of emergence.
# 1 - Election, 2 - Questionnaire, 3 - Rank, 4 - Mixed or unclear
emg_mod_emgmeasure <- BF_analysis(data_FFM_emg, mod = "mod_emergencemeasure", IV_name = "IV")$mod_result
emg_measure <- format_file_mods(emg_mod_emgmeasure, order = FFM_order, write = TRUE, filename = "emg_measure.csv")
# Publication type. In the original data file, theses and dissertations are separated. Merged into one.
data_FFM_emg$Pub <- ifelse(data_FFM_emg$`Publication code` == "J", "J", "D/T")
emg_mod_publication_type <- BF_analysis(data_FFM_emg, mod = "Pub", IV_name = "IV")$mod_result
publication_type <- format_file_mods(emg_mod_publication_type, order = FFM_order, write = TRUE, filename = "emg_pub.csv")
# Validated personality measure.
# Yes - Validated FFM scale (See a list from Judge et al., 2013), Translation of these scales, Scales derived from these validated scales
# No - None of the above
data_FFM_emg$VALID_IV <- ifelse(data_FFM_emg$`INCLUDE IN VALIDATED FFM ANALYSIS? (INCLUDING TYPE 4)` %in% c(1, 2, 3), "Yes", "No")
emg_mod_IV_validated <- BF_analysis(data_FFM_emg, mod = "VALID_IV", IV_name = "IV")$mod_result
validated_IV <- format_file_mods(emg_mod_IV_validated, order = FFM_order, write = TRUE, filename = "emg_validIV.csv")
# Rating source of personality.
# 1 - Leader self-report, 2 - Non self-report, 3 - Mixed
emg_mod_IVRater <- BF_analysis(data_FFM_emg, mod = "IV RATER = SELF? (1 = Yes, 2 = No, 3 = Mixed)", IV_name = "IV")$mod_result
data_FFM_emg$mod_IV_RATER
# Rating source of personality.
# 1 - Leader self-report, 2 - Non self-report, 3 - Mixed
emg_mod_IVRater <- BF_analysis(data_FFM_emg, mod = "mod_IV_RATER", IV_name = "IV")$mod_result
IV_rater <- format_file_mods(emg_mod_IVRater, order = FFM_order, write = TRUE, filename = "emg_IVRater.csv")
emg_mod_DVRater <- BF_analysis(data_FFM_emg, mod = "DV_RATER_SOURCE", IV_name = "IV")$mod_result
# Rating source of emergence
# 1 - Leader self-report, 3 - Skip-level supervisor, 4 - Observer, 5 - Objective, 7 - Peer, 6 - Mixed or Unclear
emg_mod_DVRater <- BF_analysis(data_FFM_emg, mod = "mod_DV_RATER_SOURCE", IV_name = "IV")$mod_result
DV_rater <- format_file_mods(emg_mod_DVRater, order = FFM_order, write = TRUE, filename = "emg_DVRater.csv")
# Common source
emg_mod_commonsource <- BF_analysis(data_FFM_emg, mod = "Common Source (X & Y)", IV_name = "IV")$mod_result
# Common source
emg_mod_commonsource <- BF_analysis(data_FFM_emg$, mod = "mod_common_source", IV_name = "IV")$mod_result
# Common source
emg_mod_commonsource <- BF_analysis(data_FFM_emg, mod = "mod_common_source", IV_name = "IV")$mod_result
common_source <- format_file_mods(emg_mod_commonsource, order = FFM_order, write = TRUE, filename = "emg_commonsource.csv")
# Research design
emg_mod_design <- BF_analysis(data_FFM_emg, mod = "mod_design", IV_name = "IV")$mod_result
research_design <- format_file_mods(emg_mod_design, order = FFM_order, write = TRUE, filename = "emg_timedesign.csv")
data_FFM_J <- readxl::read_excel("../../DataSet/B5L_Analysis_MASTER_NEW1124_NEW.xlsx", sheet = "Coding-Judge_Op")
data_FFM_eff <- data_FFM_J %>% filter(INCLUDE_AS_JUDGE_OP == 1)
data_FFM_J <- readxl::read_excel("../../DataSet/B5L_Analysis_MASTER_NEW1124_NEW.xlsx", sheet = "Coding-Judge_Op")
data_FFM_eff <- data_FFM_J %>% filter(INCLUDE_AS_JUDGE_OP == 1)
# Type of organization.
# 1 - Social Service, 2 - Education, 3 - Business, 5 - Military, 6 - Mixed
eff_mod_org <- BF_analysis(data_FFM_eff, mod = "mod_organization", IV_name = "IV")$mod_result
type_of_organization_eff <- format_file_mods(eff_mod_org, order = FFM_order, write = TRUE, filename = "eff_org.csv")
# Hierarchical level.
# 1 - Lower level supervisors, 2 - Middle managers, 3 - Upper level managers, 4 - Mixed or unclear
eff_mod_hier <- BF_analysis(data_FFM_eff, mod = "mod_hierarchicallevel", IV_name = "IV")$mod_result
hierarchical_level_eff <- format_file_mods(eff_mod_hier, order = FFM_order, write = TRUE, filename = "eff_hier.csv")
# Study setting.
# 1 - Laboratory, 2 - Organization, 3 - Classroom
eff_mod_setting <- BF_analysis(data_FFM_eff, mod = "mod_setting", IV_name = "IV")$mod_result
study_setting_eff <- format_file_mods(eff_mod_setting, order = FFM_order, write = TRUE, filename = "eff_setting.csv")
# Social complexity.
# 1 - Low complexity, 2 - High complexity
eff_mod_complexity <- BF_analysis(data_FFM_eff, mod = "mod_socialcomplexityoftask", IV_name = "IV")$mod_result
social_complexity_eff <- format_file_mods(eff_mod_complexity, order = FFM_order, write = TRUE, filename = "eff_comp.csv")
# Publication type. In the original data file, theses and dissertations are separated. Merged into one.
data_FFM_eff$Pub <- ifelse(data_FFM_eff$`Publication code` == "J", "J", "D/T")
eff_mod_publication_type <- BF_analysis(data_FFM_eff, mod = "Pub", IV_name = "IV")$mod_result
publication_type_eff <- format_file_mods(eff_mod_publication_type, order = FFM_order, write = TRUE, filename = "eff_pub.csv")
# Validated personality measure.
# Yes - Validated FFM scale (See a list from Judge et al., 2013), Translation of these scales, Scales derived from these validated scales
# No - None of the above
data_FFM_eff$VALID_IV <- ifelse(data_FFM_eff$`INCLUDE IN VALIDATED FFM ANALYSIS? (INCLUDING TYPE 4)` %in% c(1, 2, 3), "Yes", "No")
eff_mod_IV_validated <- BF_analysis(data_FFM_eff, mod = "VALID_IV", IV_name = "IV")$mod_result
validated_IV_eff <- format_file_mods(eff_mod_IV_validated, order = FFM_order, write = TRUE, filename = "eff_validIV.csv")
# Rating source of personality.
# 1 - Leader self-report, 2 - Non self-report, 3 - Mixed
eff_mod_IVRater <- BF_analysis(data_FFM_eff, mod = "IV RATER = SELF? (1 = Yes, 2 = No, 3 = Mixed)", IV_name = "IV")$mod_result
IV_rater_eff <- format_file_mods(eff_mod_IVRater, order = FFM_order, write = TRUE, filename = "eff_IVRater.csv")
# Rating source of effectiveness.
# 1 - Leader self-report, 3 - Skip-level supervisor, 4 - Observer, 5 - Objective, 7 - Peer, 6 - Mixed or Unclear
eff_mod_DVRater <- BF_analysis(data_FFM_eff, mod = "DV_RATER_SOURCE", IV_name = "IV")$mod_result
DV_rater_eff <- format_file_mods(eff_mod_DVRater, order = FFM_order, write = TRUE, filename = "eff_DVRater.csv")
# Common source
eff_mod_commonsource <- BF_analysis(data_FFM_eff, mod = "Common Source (X & Y)", IV_name = "IV")$mod_result
common_source_eff <- format_file_mods(eff_mod_commonsource, order = FFM_order, write = TRUE, filename = "eff_commonsource.csv")
# Research design
eff_mod_design <- BF_analysis(data_FFM_eff, mod = "If Cross-sectional/Lagged (X & Y)", IV_name = "IV")$mod_result
research_design_eff <- format_file_mods(eff_mod_design, order = FFM_order, write = TRUE, filename = "eff_timedesign.csv")
